package pl.koziolekweb.szkola.EFRegExNames;

// EF-RegExNames/Name.java
 
import java.util.ArrayList;

public class Name {
    private String name;
    private ArrayList<Integer> list;

    private int total = 0, lastNo = 0;

    public Name(String name, int count) {
        this.name = name;
        list = new ArrayList<Integer>();
        addNum(count);
    }

    public void addNum(int lineNo) {
        if (lastNo != lineNo) {
            list.add(lineNo);
            lastNo = lineNo;
        }
        ++total;
    }

    @Override
    public String toString() {
        return name + " (" + total + ") in lines: " + list;
    }
}
